/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_SEQUENCE_H__
#define __RGCPP_SEQUENCE_H__

#include <boost/thread.hpp>

namespace rgcpp
{

template <typename T>
class Sequence
{
	private:
		T m_cCurrentId;
		boost::recursive_mutex m_mutexSeqId;

	public:
		Sequence(T c_start_val)
		{
			m_cCurrentId=c_start_val;
		}

		T getNextSequenceId()
		{
			boost::recursive_mutex::scoped_lock cLockAutoincId(m_mutexSeqId);
			return m_cCurrentId++;
		}
};

}

#endif
